package net.xfok.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class XUI extends Activity implements OnItemClickListener {
	private static final String TAG="XUI";
	private static final String PKG="net.xfok.ui";
	private ListView mlist;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mlist=(ListView)findViewById(R.id.main);
        mlist.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,items));
        mlist.setOnItemClickListener(this);      
    }
    
    static String[] items={"TextView","Button","Drag","Dock","WebView","ListView","TabView","Layout","Animation","Launcher","Workspace","ViewGroup"};
    static String[] pkgs={"text","button","drag","dock","web","list","tab","layout","animation","home","workspace","custom"};
	
    public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		Log.i(TAG, "position="+position);	
		Intent intent=new Intent();
		try{
			intent.setClass(this, Class.forName(PKG+"."+pkgs[position]+".X"+items[position]));
			startActivity(intent);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}